﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Runtime.Serialization;

namespace CreateDirectoryStructure
{
    [Serializable()]            //Set this attribute to all the classes that want to serialize

    class Dirst : ISerializable //derive your class from ISerializable
    {
        public Stack collCheckedItems;

        //Default Constructor...
        public Dirst()
        {
            Stack collCheckedItems = new Stack();
            
        }//Dirst - Constructor



        //http://www.codeproject.com/KB/cs/objserial.aspx
        //Serialization function.
        public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
        {
            //You can use any custom name for your name-value pair. But make sure you
            // read the values with the same name. For ex:- If you write EmpId as "EmployeeId"
            // then you should read the same with "EmployeeId"

            info.AddValue("menuItem_CBoxSource", collCheckedItems);
            //info.AddValue("EmployeeName", EmpName);
        }


        //Deserialization constructor.
        public Dirst(SerializationInfo info, StreamingContext ctxt)
        {
            //Get the values from info and assign them to the appropriate properties

            collCheckedItems = (Stack)info.GetValue("menuItem_CBoxSource", typeof(Stack));
            // EmpName = (String)info.GetValue("EmployeeName", typeof(string));
        }

        public void Clear()
        {
            collCheckedItems = new Stack();
            collCheckedItems.Clear();
        }


    }//Dirst


}//CreateDirectoryStructure
